﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Register src="../Shared/Header_Report.ascx" tagname="Header_Report" tagprefix="uc1" %>
<!DOCTYPE html>
<html>
<head runat="server">
    <title>时间段详情</title>
    <uc1:Header_Report ID="Header_Report1" runat="server" />
    <script type="text/javascript">               

        function reset() {
            $('#d_begin').datebox('setValue', '');
            $('#d_end').datebox('setValue', '');
        }

        function submit() {

            var subTitle = '时间段：全部';
            var beginDate = $('#d_begin').datebox('getValue');
            var endDate = $('#d_end').datebox('getValue');
            if (beginDate != "" && endDate != "") {
                var begin = beginDate.replace("-", "").replace("-", "");
                var end = endDate.replace("-", "").replace("-", "");
                if (parseInt(begin) > parseInt(end)) {
                    $.messager.alert('提示', '起始日期不能大于结束日期！', "info");
                    return;
                }
                subTitle = "时间段：" + beginDate + ' 到 ' + endDate;
            }
            else if (beginDate != "") subTitle = "时间段：" + ">= " + beginDate
            else if (endDate != "") subTitle = "时间段：" + "<= " + endDate
                      
            
            $.ajax({
                type: "POST",
                url: "/Report/LoadPeriodReport/",
                data: { 'begin': beginDate, 'end': endDate },
                success: function (data) {
                    var maxY = getMaxY(data.series);
                    maxY = maxY + (5 - (maxY % 5));
                    drawChart('container', data.category, data.color, data.series, maxY, '消毒供应中心', subTitle, '操作流程', '数量(个)');
                },
                error: function () {
                    $.messager.alert('错误', '加载数据失败！', "error");
                }
            });
        }
               
    </script>
</head>
<body class="easyui-layout">
    <div id="north_PeriodReport" region="north" style="padding:5px;" border="false"> 
        <table style="width:100%; background-color:#EFEFEF; font-size:12px;" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="2" style="border-bottom:1px solid #CCCCCC; line-height:2;"><span style="padding-left:10px;">请输入你要查询的时间段：</span></td>
                <td style="border-bottom:1px solid #CCCCCC;"><span style="padding-left:5px;color:Red">注：查询结果显示所选时间段的包装、灭菌、发放和回收四个流程汇总</span></td>
            </tr>
            <tr>
                <td style="text-align: right; width: 80px;padding-top:2px;">开始日期：</td>
                <td style="text-align: left; width: 120px;padding-top:2px;"><input id="d_begin" type="text" class="easyui-datebox"/></td>
                <td style="text-align:right;"></td>
            </tr>
            <tr>
                <td style="text-align: right; width: 80px;">结束日期：</td>
                <td style="text-align: left; width: 120px;"><input id="d_end" type="text" class="easyui-datebox"/></td>
                <td style="padding-left:20px;">
                    <a id="btnQuery" href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="submit()">查询</a>
                    <a id="btnReset" href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-redo" plain="true" onclick="reset()">重写</a>
                </td>
            </tr>
        </table>                
    </div>
    <div region="center" style="padding: 5px;" border="false">
        <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto">
        </div>
    </div>
</body>
</html>
